#define paginate(currentPage, totalPage, link)
	#if(totalPage <= 0 || currentPage > totalPage) #return #end
	#setLocal(startPage = currentPage - 4)
	#if (startPage < 1) #setLocal(startPage = 1) #end
	
	#setLocal(endPage = currentPage + 4)
	#if (endPage > totalPage) #setLocal(endPage = totalPage) #end

	<div class="am-u-lg-12 am-cf">
		#if (currentPage <= 8)
		#setLocal(startPage = 1)
		#end
		#if ((totalPage - currentPage) < 8)
		#setLocal(endPage = totalPage)
		#end
		<div class="am-fr">
			<ul class="am-pagination tpl-pagination">
				#if (currentPage == 1)
					<li class="am-disabled"><a href="javascript:;">«</a></li>
				#else
					<li><a href="#(link)#(currentPage - 1)#(append)">«</a></li>
				#end

				#if (currentPage > 8)
					<li><a href="#(link)#(1)#(append)">#(1)</a></li>
					<li><a href="#(link)#(2)#(append)">#(2)</a></li>
					<li>…</li>
				#end

				#for(i : [startPage..endPage])
					#if (currentPage == i)
						<li class="am-active">#(i)</li>
					#else
						<li><a href="#(link)#(i)#(append)">#(i)</a></li>
					#end
				#end

				#if ((totalPage - currentPage) >= 8)
					<li>…</li>
					<li><a href="#(link)#(totalPage - 1)#(append)">#(totalPage - 1)</a></li>
					<li><a href="#(link)#(totalPage)#(append)">#(totalPage)</a></li>
				#end

				#if (currentPage == totalPage)
					<li class="am-disabled"><a href="javascript:;">»</a></li>
				#else
					<li><a href="#(link)#(currentPage + 1)#(append)" rel="next">»</a></li>
				#end
			</ul>
		</div>
	</div>
#end
